# -*- coding: utf-8 -*-
# @Python：3.8
# @项目：happiness_order
# @文件：log_util.py
# @时间：2025/1/20 18:54
# @作者：yangzhang
# @desc:
import logging
import os

project_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
log_path = os.path.join(project_path,'logs')
if not os.path.exists(log_path):
    os.makedirs(log_path)
log_file_path = os.path.join(log_path, 'qiyeWechat.api.test.log')

logger = logging.getLogger()
# 配置日志级别为DEBUG
logger.setLevel(level=logging.DEBUG)

# 配置日志处理器
handler = logging.FileHandler(filename=log_file_path,encoding='utf-8',mode='a')
handler.setLevel(logging.INFO)
# 配置日志格式
formatter = logging.Formatter('%(asctime)s[%(levelname)s]-[%(filename)s:%(funcName)s:%(lineno)d]: %(message)s')
handler.setFormatter(formatter)

logger.addHandler(handler)

if __name__ == '__main__':
    logger.debug('test')